package shared.Messages;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import Server.Game.Questions.Answer;
import Server.Game.Questions.Question;

public class QuestionMessage extends Message{
	
	private static final long serialVersionUID = 2540742453139625683L;
	public transient int GameNo;
	public transient int playerId;
	public String questionContent;
	public List <String> answersContent;
	public int points1;
	public int points2;
	
	public QuestionMessage(Question question, int GameNo, int playerId, int points1, int points2){
		questionContent = question.getContent();
		answersContent = getAnswersContent(question);
		this.GameNo = GameNo;
		this.playerId = playerId;
		this.points1 = points1;
		this.points2 = points2;
	}

	
	public List<String> getAnswersContent(Question question) {
		List<String>getAnswersContent = new ArrayList<String>();
		Iterator<Answer> i = question.getAnswers().iterator();
		while (i.hasNext()) {
			Answer a = i.next();
			getAnswersContent.add(a.getContent());
		}
		return getAnswersContent;
	}

}
